package com.zhangji.springcloud.controller;

import com.zhangji.springcloud.pojo.Dept;
import com.zhangji.springcloud.service.ConfigDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: 提供Restful服务
 * @Author: Zhang Ji
 * @Date: 2021/6/22 20:45
 * Created by IntelliJ IDEA.
 */
@RestController
public class ConfigDeptController {

    @Autowired
    private ConfigDeptService configDeptService;

    @PostMapping("/dept/add")
    public boolean addDept(@RequestBody Dept dept){
        return configDeptService.addDept(dept);
    }

    @GetMapping("/dept/get/{id}")
    public Dept queryDeptById(@PathVariable("id") Long id){
        return configDeptService.queryDeptById(id);
    }

    @GetMapping("/dept/queryAll")
    public List<Dept> queryAll(){
        return configDeptService.queryAll();
    }


}
